package com.ozo.cloud.gen.pojo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * <p>
 * 表字段创建对象
 * </p>
 *
 * @author qiangesoft
 * @date 2024-03-13
 */
@Schema(description = "表字段创建对象")
@Data
public class GenTableColumnCreateDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @NotBlank(message = "字段注释不能为空")
    @Schema(description = "字段注释")
    private String columnComment;

    @Pattern(regexp = "^[a-z0-9_]+$", message = "字段名只能为小写英文字母、数字和_")
    @Schema(description = "字段名称")
    private String columnName;

    @NotBlank(message = "字段类型不能为空")
    @Schema(description = "字段类型")
    private String columnType;

    @Min(value = 1, message = "数据长度大于0")
    @NotNull(message = "数据长度不能为空")
    @Schema(description = "数据长度")
    private Integer dataLength;

    @Max(value = 127, message = "数据长度不大于127")
    @Schema(description = "小数位长度")
    private Integer decimalLength;

    @Schema(description = "默认值")
    private String defaultValue;

    @NotNull(message = "字段是否主键不能为空")
    @Schema(description = "字段是否主键")
    private Boolean columnPk;

    @NotNull(message = "字段是否非空不能为空")
    @Schema(description = "字段是否非空")
    private Boolean columnNotNull;

    @NotNull(message = "字段是否自增不能为空")
    @Schema(description = "字段是否自增")
    private Boolean columnIncrement;

}
